package com.ruoyi.system.billiards.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.BilliardsGameEightBallMember;
import com.ruoyi.system.service.IBilliardsGameEightBallMemberService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 中式八球比赛用户Controller
 * 
 * @author ruoyi
 * @date 2024-12-11
 */
@RestController
@RequestMapping("/billiards/gameMember")
public class BilliardsGameEightBallMemberController extends BaseController
{
    @Autowired
    private IBilliardsGameEightBallMemberService billiardsGameEightBallMemberService;

    /**
     * 查询中式八球比赛用户列表
     */
    @PreAuthorize("@ss.hasPermi('billiards:gameMember:list')")
    @GetMapping("/list")
    public TableDataInfo list(BilliardsGameEightBallMember billiardsGameEightBallMember)
    {
        startPage();
        List<BilliardsGameEightBallMember> list = billiardsGameEightBallMemberService.selectBilliardsGameEightBallMemberList(billiardsGameEightBallMember);
        return getDataTable(list);
    }

    /**
     * 导出中式八球比赛用户列表
     */
    @PreAuthorize("@ss.hasPermi('billiards:gameMember:export')")
    @Log(title = "中式八球比赛用户", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BilliardsGameEightBallMember billiardsGameEightBallMember)
    {
        List<BilliardsGameEightBallMember> list = billiardsGameEightBallMemberService.selectBilliardsGameEightBallMemberList(billiardsGameEightBallMember);
        ExcelUtil<BilliardsGameEightBallMember> util = new ExcelUtil<BilliardsGameEightBallMember>(BilliardsGameEightBallMember.class);
        util.exportExcel(response, list, "中式八球比赛用户数据");
    }

    /**
     * 获取中式八球比赛用户详细信息
     */
    @PreAuthorize("@ss.hasPermi('billiards:gameMember:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(billiardsGameEightBallMemberService.selectBilliardsGameEightBallMemberById(id));
    }

    /**
     * 新增中式八球比赛用户
     */
    @PreAuthorize("@ss.hasPermi('billiards:gameMember:add')")
    @Log(title = "中式八球比赛用户", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BilliardsGameEightBallMember billiardsGameEightBallMember)
    {
        return toAjax(billiardsGameEightBallMemberService.insertBilliardsGameEightBallMember(billiardsGameEightBallMember));
    }

    /**
     * 修改中式八球比赛用户
     */
    @PreAuthorize("@ss.hasPermi('billiards:gameMember:edit')")
    @Log(title = "中式八球比赛用户", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BilliardsGameEightBallMember billiardsGameEightBallMember)
    {
        return toAjax(billiardsGameEightBallMemberService.updateBilliardsGameEightBallMember(billiardsGameEightBallMember));
    }

    /**
     * 删除中式八球比赛用户
     */
    @PreAuthorize("@ss.hasPermi('billiards:gameMember:remove')")
    @Log(title = "中式八球比赛用户", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(billiardsGameEightBallMemberService.deleteBilliardsGameEightBallMemberByIds(ids));
    }
}
